class User < ActiveRecord::Base
  belongs_to :account
  has_one :user_info, :dependent => :destroy
  has_one  :user_image,:dependent=>:destroy
  has_many :courses ,:through=>:user_courses
  has_many :user_courses


  def my_courses
    self.user_courses.find(:all ,:conditions=>"ownned_flag=1")
  end

  def learned_courses
    self.user_courses.find(:all ,:conditions=>"progress>0")
  end
end
